﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using HFController;
using System.Web.Script.Serialization;
using System.Web.SessionState;
using System.Web.Services;

namespace HFWebApp.AjaxSource
{
    /// <summary>
    /// UserLogin 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class UserLogin : IHttpHandler, IRequiresSessionState

    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            BagePages bp = new BagePages();
            string uid = bp.GetAll("login_uid");
            string pwd = bp.GetAll("login_pwd");
            string login_isRem = bp.GetAll("login_isRem");
            HFModel.ResultModel result = UserController.getController().doUserLogin_ForAjax(uid, pwd ,login_isRem);
            context.Response.Write(this.getJSONResult(result));
            context.Response.End();
        }

        protected string getJSONResult(HFModel.ResultModel result)
        {
            JavaScriptSerializer jsSerializer = new JavaScriptSerializer(new SimpleTypeResolver());
            return jsSerializer.Serialize(result);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}